<?php

/**
 * Form Textarea Element class
 *
 * @author Mathieu Pheulpin - sokaru91@gmail.com
 *
 */
class Mac_Form_Element_Textarea extends Mac_Form_Element_Abstract
{
    protected $cols = 30;

    protected $rows = 4;

    public function setSize ($rows, $cols)
    {
        $this->rows = $rows;
        $this->cols = $cols;
        return $this;
    }

    public function __toString ()
    {
        return '<textarea
            id="'.$this->id.'"
            name="'.$this->name.'"
            cols="'.$this->cols.'"
            rows="'.$this->rows.'"
            '.((count($this->class) > 0) ? 'class="'.implode(' ', $this->class).'"' : '').'
            '.$this->printOptions().'
        >'.((string)$this->getValue()).'</textarea>';
    }
}